package org.andromeo.util;

import org.andromeo.GRSession;

import android.content.Context;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;

public class CookieSync {

	public static synchronized void sync(Context ctx, GRSession grsession) {
		String cookiestr = "";
		for (String cookie : grsession.getSessionCookie()) {
			cookiestr += cookie;
		}
		CookieSyncManager.createInstance(ctx);
		CookieManager cookieManager = CookieManager.getInstance();
		
		// ReferenzURL + Cookie f?r CookieManager hinterlegen
		cookieManager.setCookie(grsession.getGrurl(), cookiestr);
		CookieSyncManager.getInstance().sync();
	}
}
